<template>
	<!-- 新增 -->
	<el-dialog
		title="提示"
		:visible.sync="dialog"
		width="400px">
		<!-- 内容 -->
		<div class="offHeader">
			<p class="none">请填写下线原因</p>
			<div class="group">
				<el-select v-model="value_reason" size="small">
					<el-option
						v-for="item in list_reason"
						:key="item.value"
						:label="item.label"
						:value="item.value">
					</el-option>
				</el-select>
			</div>
			<div class="group">
				<el-input
					type="textarea"
					:rows="4"
					placeholder="备注（选填）"
					v-model="content">
				</el-input>
			</div>
		</div>
		<!-- 提交 -->
		<div class="flex flex-end">
			<div class="btn">
				<el-button
					@click="dialog = false"
					size="small">取消
				</el-button>
			</div>
			<div class="btn">
				<el-button
					type="primary"
					@click="submit()"
					size="small">确定
				</el-button>
			</div>
		</div>
	</el-dialog>
</template>

<script>
export default {
	props:["ifShow","formData","type"],
	watch:{
		ifShow(val){
			this.dialog = true;
			this.value_reason = '内容违规';
			this.content = '';
		}
	},
	data() {
		return {
			dialog:false,
			content:"",
			value_reason:"",
			list_reason:[
				 {
					 value:"包含敏感词",
					 label:"包含敏感词"
				 },
				 {
					 value:"内容涉嫌侵权",
					 label:"内容涉嫌侵权"
				 },
				 {
					 value:"涉嫌导向舆论",
					 label:"涉嫌导向舆论"
				 },
				 {
					 value:"内容违规",
					 label:"内容违规"
				 },
				 {
					 value:"内容低俗",
					 label:"内容低俗"
				 },
				 {
					 value:"内容被投诉",
					 label:"内容被投诉"
				 },
				 {
					 value:"off",
					 label:"其他原因"
				 }
			 ],
		};
	},
	methods:{
		//提交
		submit:function(){
			let select = this.value_reason?this.value_reason + ':':'';
			HTTP('robot_off', {
				contentType:this.formData.contentType?this.formData.contentType:this.type,
				uid:this.formData.uid,
				status:'1',
				reason:this.value_reason=="off"?this.content:this.value_reason
				//reason:select + this.content
			})
			.then(res=>{
				if(res.code == 200){
					this.dialog = false;
					this.common.msg('下线成功');
					this.$emit('httpSuccess',1);
				}
				else{
					this.common.msg(res.msg,'error');
				}
			})
		}
	}
};
</script>

<style lang="scss" scoped>
	// 饿了么样式
	/deep/ .el-dialog__header{
		text-align: center;
	}
	/deep/ .el-textarea__inner{
		height: 100px;
	}
	/deep/ .el-dialog__body{
		padding: 20px 30px;
	}

	.group{
		margin: 12px 0;
	}
	.btn{
		margin-left: 20px;
		margin-top: 20px;
	}
</style>
